2.8.1 Integrals and Derivatives

Integral and derivative expressions are entered using a bifix notation with an introductory symbol and an infix operator. Only the syntax is described here. For more information on working with integrals and derivatives, see §4.

Integral expressions use an introductory symbol and an infix operator ⅆ. The expression between and ⅆ is the integrand and the expression to the right of ⅆ is the integrator. For example, together with the introductory symbol, the input text ∫x^3ⅆx displays as ∫x^3 ⅆx.


(a) Integral

(b) Integral bounds

(c) Decoration
Figure 2.36 Integral with optional bounds and decoration

Definite integrals require two more operands, being the lower and upper limits of the integral. These are encoded along with the integrand in a comma-separated list; the first list element is the lower limit, the second is the upper limit and the third is the integrand. For example, ∫0,π,x^3ⅆx displays as ∫0, ℼ, x^3 ⅆx.

The result of integrating a definite integral is a definite integration. This is entered with an introductory symbol | in place of . For example, |0,π,x^4÷4ⅆx displays as |0, ℼ, x^4÷4 ⅆx and means ℼ^4÷4-0^4÷4.

Figure 2.37 Integration

A decorated integral usually results from u-substitution (see §4.4.2 and §4.4.3) although it can be entered manually. The decoration is a function that remaps a subexpression of the integrand. Syntactically, a decorated integral is any integral whose integrator is a function. However, the integrator must be parenthesized due to precedence. An example is ∫e^u ⅆ(u(x)→x^2), which displays as ∫e^u ⅆ(u(x)→x^2).

Syntactic variations with simpler input that parse into the same display form are ∫e^u ⅆ(u→x^2) and ∫e^u ⅆ(u=x^2). The latter promotes the equality expression to a definition and both use parameter inference.

Derivative expressions are entered using the same two-part notation as integral expressions except the introductory operator is ⅆ instead of . For example, the derivative of x^2 with respect to x is written as ⅆx^2 ⅆx and displays as ⅆx^2ⅆx. The expression between the two ⅆ symbols is the derivand and the expression following the second ⅆ is the derivator.

Higher order derivatives are entered with the order trailing the second operand, separated by a colon. For example, the second-derivative ⅆx^2ⅆx:2 is entered as ⅆx^2ⅆx:2.


(a) Derivative

(b) Partial derivative
Figure 2.38 Derivatives

For both integration and differentiation, the expression following ⅆ is a primary operand. This means that if the integrator or derivator is other than a simple variable, it must be entered in parenthesis. For example, the derivative of x2 with respect to x2 is entered as ⅆ(x^2) ⅆ(x^2) and displays as ⅆx^2ⅆ(x^2). (When simplified, the derivative is 1.)

A partial derivative produces the derivative of one variable while holding other variables constant. For a binomial in two unknowns, a partial derivative produces the expression for a plane tangent to a surface along one dimension. Mixed partial derivatives are not supported, but can be combined using a partial derivative as the operand of a partial derivative.

A gradient is the derivative of two or more variables combined into a vector. The geometric interpretation of a gradient of a binomial in two unknowns is a line tangent to a surface in the "steepest" direction.

Figure 2.39 Gradient

The gradient construct is similar to the derivative construct; it encloses an expression in ∇ (pronounced “nabla”) and ⅆ followed by a list of variables whose partial derivatives will be taken. A variation on this notation, called a definite gradient, incorporates a vector that can be applied to the partial derivatives.

Given a function f(x, y)→2⋅x⋅y+x+y^x, the partial derivatives can be combined into a vector (∂f(x, y)∂x, ∂f(x, y)∂y)ʋ. The vector can be expanded through substitution to

(∂2⋅x⋅y+x+y^x∂x, ∂2⋅x⋅y+x+y^x∂y)ʋ

 


and the elements simplified individually to

(2⋅y+1+y^x⋅ln y, 2⋅x+x⋅y^(x-1))ʋ.

 


The same result can be achieved by simplifying the gradient expression ∇2⋅x⋅y+x+y^xⅆ(x, y).

A decoupled derivative separates the derivand and derivator, allowing them to be manipulated as independent expressions. Recall the trifix notation ⅆ derivand ⅆ derivator : order couples the derivand and derivator. The notation for a decoupled derivative looks like the second part of a higher order coupled derivative. To decouple ⅆ x^2 ⅆ x, the derivand is entered as ⅆx^2:1 and the derivator as ⅆx:1. When two decoupled derivatives are combined in a divide operator, they form an idiomatic expression that represents a coupled derivative. The decoupled idiom displays differently from the coupled form: ⅆx^2:1÷ⅆx:1 versus ⅆx^2ⅆx. A coupled derivative and the idiomatic form of two decoupled derivatives can be transformed one into the other using →Differential (see §3.6.4).

Decoupled derivatives are used to manipulate expressions like ⅆx:1÷ⅆu:1⋅(ⅆu:1÷ⅆy:1).